// 1. 点击删除清除

import {
  DEL_TODO,
  CHANGE_DONE,
  ADD_TODO,
  SELECT_ALL,
  EDIT_NAME,
  DEL_COMPLETED,
} from '../constant/todos'
/**
 *  删除todo项
 * @param {*} id
 * @returns
 */
export const delTodo = (id) => {
  return { type: DEL_TODO, id }
}
/**
 *  修改是否完成的状态
 * @param {*} id
 * @param {*} done
 * @returns
 */
export const changeDone = (id) => ({ type: CHANGE_DONE, id })
/**
 *  添加任务
 * @param {*} name
 * @returns
 */

export const addTodo = (name) => ({ type: ADD_TODO, name, id: Date.now() })

/**
 * 全选
 * @returns
 */
export const selectAll = (done) => ({ type: SELECT_ALL, done })
/**
 * 修改name
 * @param {*} name
 * @returns
 */
export const editName = (name, id) => ({ type: EDIT_NAME, name, id })

/**
 * 清除已完成
 * @returns
 */
export const delCompleted = () => ({ type: DEL_COMPLETED })


